package com.longfa.ojbackenduserservice.controller.inner;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.longfa.ojbackendmodel.model.dto.user.UserQueryRequest;
import com.longfa.ojbackendmodel.model.entity.User;
import com.longfa.ojbackendserviceclient.service.UserFeignClient;
import com.longfa.ojbackenduserservice.service.UserService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Collection;
import java.util.List;

/**
 * ClassName: InnerUserController
 * Package: com.longfa.ojbackenduserservice.controller.inner
 * Description: 这个controller仅供服务内部调用，不提供给前端
 *
 * @Author:
 * @Create: 2024/5/3 - 20:18
 * @Version: v1.0
 */
@RestController
@RequestMapping("/inner")
public class InnerUserController implements UserFeignClient {

    @Resource
    private UserService userService;
    @Override
    @GetMapping("/get/ids")
    public List<User> listByIds(@RequestParam("idList") Collection<Long> idList) {
        return userService.listByIds(idList);
    }

    @Override
    @GetMapping("/get/id")
    public User getById(@RequestParam("userId") long userId) {
        return userService.getById(userId);
    }
}
